using System;
using System.Collections.Generic;


namespace Gfw.Models.Admin
{
	[Serializable]
	public partial class UsrUserfinance: IEquatable<UsrUserfinance>
	{

		#region Private Members

		private string _id; 
		private UsrUser _userid; 
		private string _bankname; 
		private string _bankcardno; 
		private string _bankusername; 
		private string _bankaddress; 
		private string _tenpay; 
		private string _alipay; 		
		#endregion

		#region Constructor

		public UsrUserfinance()
		{
			_id = String.Empty; 
			_userid = new UsrUser(); 
			_bankname = String.Empty; 
			_bankcardno = String.Empty; 
			_bankusername = String.Empty; 
			_bankaddress = String.Empty; 
			_tenpay = String.Empty; 
			_alipay = String.Empty; 
		}
		#endregion // End of Default ( Empty ) Class Constuctor

		#region Required Fields Only Constructor
		/// <summary>
		/// required (not null) fields only constructor
		/// </summary>
		public UsrUserfinance(
			string id, 
			UsrUser userid)
			: this()
		{
			_id = id;
			_userid = userid;
			_bankname = String.Empty;
			_bankcardno = String.Empty;
			_bankusername = String.Empty;
			_bankaddress = String.Empty;
			_tenpay = String.Empty;
			_alipay = String.Empty;
		}
		#endregion // End Constructor

		#region Public Properties
			
		public virtual string Id
		{
			get
			{ 
				return _id;
			}

			set	
			{	
				if( value == null )
					throw new ArgumentOutOfRangeException("Null value not allowed for Id", value, "null");
				
				if(  value.Length > 40)
					throw new ArgumentOutOfRangeException("Invalid value for Id", value, value.ToString());
				
				_id = value;
			}
		}
			
		public virtual UsrUser Userid
		{
			get
			{ 
				return _userid;
			}
			set
			{
				if( value == null )
					throw new ArgumentOutOfRangeException("Null value not allowed for Userid", value, "null");

				_userid = value;
			}

		}
			
		public virtual string BankName
		{
			get
			{ 
				return _bankname;
			}

			set	
			{	
				if(  value != null &&  value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for BankName", value, value.ToString());
				
				_bankname = value;
			}
		}
			
		public virtual string BankCardNo
		{
			get
			{ 
				return _bankcardno;
			}

			set	
			{	
				if(  value != null &&  value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for BankCardNo", value, value.ToString());
				
				_bankcardno = value;
			}
		}
			
		public virtual string BankUserName
		{
			get
			{ 
				return _bankusername;
			}

			set	
			{	
				if(  value != null &&  value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for BankUserName", value, value.ToString());
				
				_bankusername = value;
			}
		}
			
		public virtual string BankAddress
		{
			get
			{ 
				return _bankaddress;
			}

			set	
			{	
				if(  value != null &&  value.Length > 256)
					throw new ArgumentOutOfRangeException("Invalid value for BankAddress", value, value.ToString());
				
				_bankaddress = value;
			}
		}
			
		public virtual string TenPay
		{
			get
			{ 
				return _tenpay;
			}

			set	
			{	
				if(  value != null &&  value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for TenPay", value, value.ToString());
				
				_tenpay = value;
			}
		}
			
		public virtual string Alipay
		{
			get
			{ 
				return _alipay;
			}

			set	
			{	
				if(  value != null &&  value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for Alipay", value, value.ToString());
				
				_alipay = value;
			}
		}
			
				
		#endregion 

		#region Public Functions

		#endregion //Public Functions

		#region Equals And HashCode Overrides
		/// <summary>
		/// local implementation of Equals based on unique value members
		/// </summary>
		public override bool Equals( object obj )
		{
			if( this == obj ) return true;
			if( ( obj == null ) || ( obj.GetType() != this.GetType() ) ) return false;
			UsrUserfinance castObj = (UsrUserfinance)obj; 
			return ( castObj != null ) &&
				( this._id == castObj.Id );
		}
		
		/// <summary>
		/// local implementation of GetHashCode based on unique value members
		/// </summary>
		public override int GetHashCode()
		{
			
			int hash = 57; 
			hash = 27 ^ hash ^ _id.GetHashCode();
			return hash; 
		}
		#endregion
		
		#region IEquatable members

		public virtual bool Equals(UsrUserfinance other)
		{
			if (other == this)
				return true;
		
			return ( other != null ) &&
				( this._id == other.Id );
				   
		}

		#endregion
		
	}
}
